<template>
  <div>
    <navTop :headTitle="headTitle" :showBack="showBack" :bkParam="bkParam" @hideCurr="hideDocInfo($event)"></navTop>
    <transition name="fade" mode="in-out">
      <section class="scroll_container">
        <div class="dp_content">
          <div class="dp_1">
            <p><span><img :src="root + doctorDetail[0].DOCTOR_PIC_URL" class="modImg"/></span></p>
            <p>{{doctorDetail[0].DOCTOR_NAME}}</p>
            <p>{{doctorDetail[0].ZYDJ}}&nbsp;{{doctorDetail[0].SSKBMC}}&nbsp;{{doctorDetail[0].SSYYMC}}</p>
            <p>综合评分<i class="iconfont icon-xingxing"></i><b style="color:rgb(247, 237, 27);">9.9</b></p>
          </div>
          <!--  预留备用功能
      <div class="dp_2">
        <span><i class="iconfont icon-yuyue"></i>排班</span>
        <span><i class="iconfont icon-xihuan" style="color :#de5625"></i>关注357</span>
        <span><i class="iconfont icon-fenxiang"></i>分享</span>
      </div> -->
          <div class="dp_3">
            <p><b style="color:black;padding-left:1rem;font-size:1rem">擅长：</b>{{doctorDetail[0].SC}}</p>
          </div>
        </div>
      </section>
    </transition>
  </div>
</template>

<script>
import navTop from '~/components/common/navTop.vue';

const { config } = window;
export default {
  // props: ['doctorId'],
  data() {
    return {
      DATA: { doctor_id: '10000' }, // 向服务请求的数据DATA /* doctor_id: this.doctorId */
      TN: 'F27.APP.05.09',
      RYBID: '',
      root: `${config.APIRoot}/doctor`,
      bkParam: 'bk',
      ts: this.newStore(), // 封装的返回的promise对象
      td: this.requestData(), // 封装的请求数据对象
      tq: this.getData(),
      headTitle: '',
      showBack: true,
      doctorDetail: [{
        COUNTNUM: '', // ..返回数量
        DOCTOR_ID: '',
        DOCTOR_NAME: '',
        DOCTOR_SEX: '',
        DOCTOR_MOBILE: '',
        OPENID: '',
        ZYDJ: '', // 职业等级 zr主任医师、 fzr副主任医师
        ZYZH: '', // 职业证号
        SFZH: '', // 身份证号
        LXDH: '', // 联系电话
        LXDZ: '',
        SSYYMC: '', // 医院名称
        SSKBMC: '', // 科室
        DOCTOR_PIC_URL: '', // 医师头像图片
        SC: '', // 擅长
        GRJJ: '', // 个人简介
        REGDATE: '', // 注册时间
      }],
    };
  },
  components: {
    navTop,
  },
  mounted() {
    console.log(`初始化doctor_id的值：${this.$route.query.doctorId}`);
    this.DATA.doctor_id = `${this.$route.query.doctorId}`;
    this.getDoctorDetail();
  },
  methods: {
    //
    hideDocInfo(msg) {
      this.$emit('chgDocInfoShow', msg);
    },

    /*
    getDoctorDetail() {
      this.spost(this.ts, config.APIINTERFACE, { '': this.td.InitParam(this.TN, this.RYBID, this.DATA) }).then((ts) => { console.log(`请求正常返回: ${JSON.stringify(ts.d)}`); this.doctorDetail = ts.d.DATAOBJ.DATA; }).catch((ts) => { console.log(`请求返回异常： ${JSON.stringify(ts.d)}`); });
    }, */

    getDoctorDetail() {
      this.tq.getDoctorDetail(this.DATA).then((ts) => {
        console.log(`绝望中的求生存：${JSON.stringify(ts.d)}`);
        this.doctorDetail = ts.d.DATAOBJ.DATA;
      });
      console.log('使用封装后的方法请求的数据：------------');
    },

  },
};
</script>

<style lang="stylus" scoped>
.modImg
    vertical-align none
.dp_content
    margin-top 2.4rem
    font-size 0.9rem
    background #f1f1f1
    min-height 100vh
.dp_1
    background #26a2ff
    padding-bottom 2rem
    p
        color #fff
        text-align center
        &:nth-child(1)
            padding-top 0.1rem
            height 5rem
            line-height 5rem
            span
                background #ffffff
                display inline-block
                width 4rem
                height 4rem
                border-radius 50%
        &:nth-child(2)
            font-size 1.3rem
        &:nth-child(3)
            height 2rem
            line-height 2rem
        &:last-child
        i
            margin-left 0.3rem
        span
            img
              border-radius 50%
              width 4rem
              height 4rem
.dp_2
    display flex
    justify-content space-around
    height 3rem
    line-height 3rem
    background #fff
    i
        color #aaa
        font-size 1.5rem
        float left
        margin-right 0.2rem
.dp_3
    padding 1rem
    line-height 1.5rem
    background #fff
    border-top 1px solid #ccc
    color #aaa
</style>

